package sunwin.yoms.web.comm;

import java.util.List;

/**
 * Created by mt on 2015/7/30.
 * 响应ajax类
 */
public class YomsAjaxAnswer {
    private boolean isSuccess;
    private String data;
    private String exception;
    private List<String> exceptions;

    public static YomsAjaxAnswer getInstance(boolean isSuccess) {
        return new YomsAjaxAnswer(isSuccess);
    }

    public static YomsAjaxAnswer getInstance() {
        return new YomsAjaxAnswer(true);
    }

    public static YomsAjaxAnswer getInstance(boolean isSuccess, String exception, List<String> exceptions) {
        return new YomsAjaxAnswer(isSuccess, exception, exceptions);
    }

    public static YomsAjaxAnswer getInstance(boolean isSuccess, String exception) {
        return new YomsAjaxAnswer(isSuccess, exception);
    }

    public YomsAjaxAnswer(boolean isSuccess, String exception, List<String> exceptions) {
        this.isSuccess = isSuccess;
        this.exception = exception;
        this.exceptions = exceptions;
    }

    public YomsAjaxAnswer(boolean isSuccess, String exception) {
        this.isSuccess = isSuccess;
        this.exception = exception;
    }

    public YomsAjaxAnswer(boolean isSuccess) {
        this.isSuccess = isSuccess;
    }

    public YomsAjaxAnswer(String exception) {
        this.exception = exception;
    }

    public YomsAjaxAnswer() {
    }

    public String getData() {
        return data;
    }

    public void setData(String data) {
        this.data = data;
    }

    public boolean isSuccess() {
        return isSuccess;
    }

    public void setSuccess(boolean isSuccess) {
        this.isSuccess = isSuccess;
    }

    public String getException() {
        if (this.exception == null) {
            return "";
        }
        return exception;
    }

    public void setException(String exception) {
        this.exception = exception;
    }

    public List<String> getExceptions() {
        return exceptions;
    }

    public void setExceptions(List<String> exceptions) {
        this.exceptions = exceptions;
    }
}
